package server.container;

import server.servlet.Servlet;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @description:
 * @author: Archie Wan
 * @time: 2020/12/28 14:34
 */
public class Wrapper extends Container{
    
    private String urlPattern;
    private Servlet servlet;
    
    public String getUrlPattern() {
        return urlPattern;
    }
    public void setUrlPattern(String urlPattern) {
        this.urlPattern = urlPattern;
    }
    public Servlet getServlet() {
        return servlet;
    }
    public void setServlet(Servlet servlet) {
        this.servlet = servlet;
    }
    
    public boolean matcher(String uri) {
        Pattern compile = Pattern.compile(urlPattern);
        Matcher matcher = compile.matcher(uri);
        return matcher.find();
    }
}
